class_name Stat extends Resource

@export var max_health := 0

@export var health := 0:
	set(value):
		var pre_health = health
		if value > max_health:
			value = max_health
		health = value
		if health != pre_health : health_change.emit(health)
		#如果生命低于0就发出信号
		if health <= 0:
			no_health.emit()
		elif health >= max_health:
			health = max_health
			


signal health_change(new_health)
signal no_health()
